SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
With MIT’s App Inventor 2, anyone can build complete, working Android apps—without writing code! This complete tutorial will help you do just that, even if you have absolutely no programming experience.
Unlike books focused on the obsolete Google version, Learning MIT App Inventor is written from the ground up for MIT’s dramatically updated Version 2.
The authors guide you step-by-step through every task and feature, showing you how to create apps by dragging, dropping, and connecting puzzle pieces—not writing code. As you learn, you’ll also master expert design and development techniques you can build on if you ever do want to write code.
Through hands-on projects, you’ll master features ranging from GPS to animation, build high-quality user interfaces, make everything work, and test it all with App Inventor’s emulator. (You won’t even need an Android device!)
All examples for this book are available at theapplanet.com/appinventor
Coverage includes:
Please download the supplementary files associated with Learning MIT App Inventor here.
Please visit the website associated with Learning MIT App Inventor at theapplanet.com/appinventor/.
Building with MIT App Inventor
Download the sample pages (includes Chapter 2 and Index)
Preface xiv
1 An Introduction to Programming 1
Operating Systems 2
User Interface 4
Android Strengths 6
Extending App Capabilities 8
Google Services 9
Applications 10
Programming Languages 11
Summary 13
Exercises 14
2 Building with MIT App Inventor 17
The MIT App Inventor Site 17
Signing In 18
Designer 20
Blocks Editor 20
The AI2 Companion App 21
The Android Emulator 23
USB Connection to Android Device 23
Getting Inside an App 25
Event Handlers 25
Doing One Thing at a Time 26
Exercise: Sherlock Is Watching 27
Adding an Image 29
What Can You Build? 31
Speak, Android! 31
Pollock 31
Fore 32
Android Quiz 32
Uploading to Google Play 32
Summary 33
Exercises 34
3 App Inventor Toolkit 35
Creating a New Project 36
Designer Essentials 36
Palette 37
Viewer 44
Components 45
Properties 46
Media 46
Exercise: Speak, Android! 47
Connecting Your Device 48
See Your App on a Connected Device 50
Summary 54
Exercises 54
4 Variables 55
Component Properties: The Built-in Variables 56
Clicker-Counter App 56
Properties: Getters and Setters 57
Clicker Counter Extensions 58
Event Parameters: Special Variables 58
Exercise: Pollock 60
The Interface 60
Programming Blocks 62
Additional Exercises 64
Scope: Global and Local Variables 64
Global Variables 66
Example App: Up/Down Counter 67
Local Variables 68
An Example App: Random Guess 69
What You Can Store in Variables 72
Summary 72
5 Procedures 75
What Is a Procedure? 75
Types of Procedures 76
Why Use Procedures? 79
Arguments 79
Exercise: Flick 81
Additional Exercises 83
Summary 84
6 Working with Lists 85
Modeling Things with Data 85
The List Block 85
The Basics 87
Creating an Empty List 87
Creating a List with Some Stuff Already In It 88
Working with Lists 91
Color as a List 92
Types of Lists 92
The One-Dimensional List 92
Lists as Data Structures 93
Using Multiple Lists Together (That Expand on Demand) 94
Abstraction with Lists and Procedures 98
Lists that Expand on Demand 100
Common Problems 102
Running Off the End of the List 102
Defining a Variable That Depends on Runtime Elements 104
Exercise: Android Quiz 105
Additional Exercises 112
Summary 112
7 Games and Animations 113
Adding Animations 113
ImageSprite 114
Ball 115
Canvas 116
Animation Examples 117
Smoother Animation 118
Edges and Collisions 119
Exercise: Fore 119
Additional Exercises 123
Summary 123
8 Multiple Screens and Debugging Techniques 125
Why More Than One Screen? 125
Building Apps with Multiple Screens 126
What Screens Are Good At 127
Issues with Multiple Screens 127
Switching Screens 128
Sharing Data Between Screens 129
Debugging Techniques 130
Leaving Comments 130
Test Small and Test Often 131
Do It 131
Name Well 132
Backing up Your Work 133
Exercise: Pollock Plus One 134
Additional Exercises 136
Summary 136
9 Using Media 139
Audio 140
Images 141
The ImagePicker 141
The Camera 144
Video 1 45
Exercise: Camera Action 146
Additional Exercises 146
Summary 147
10 Sensors 149
Building Location-Aware Apps 150
Using Location 150
Location Data 152
Using the Maps App with Intents 153
Saving Location Data 155
The Accelerometer 158
Detecting Tilt (and a Little Background Physics) 159
The Orientation Sensor 160
Exercise: Pushpin 161
Part 1: Designing Current Location Readout 161
Programming Part 1: The Current Location Readout 165
Part 2: Pinning a Location to Remember Later 168
Programming Part 2: Pinning a Location 170
Extension Activities 172
Summary 172
11 Databases 173
TinyDB 174
Retrieving Data from TinyDB 175
A Few TinyDB Details 176
TinyWebDB 176
Setting Up Your Own Web Database Service 176
Security and Privacy 177
FusionTables 177
Using Web GET and POST 180
Basic Files 181
Web APIs 182
Exercise: WriteMore 182
Additional Exercises 186
Summary 187
12 Distributing an App 189
Live Mode 189
Security Settings 190
Creating an APK File 191
Downloading Directly to a Computer 192
Downloading with a QR Code 196
Creating an .aia File 198
Exercise: App Distribution 200
Version Codes 200
Google Play Developer Console 201
Summary 205
Index 207